package Top_Interview_Questions.Bit_Manipulation;

/**
 * @Author: 吕庆龙
 * @Date: 2020/2/2 16:50
 * <p>
 * 功能描述:
 */
public class _0371 {


    /**
     * https://leetcode-cn.com/problems/sum-of-two-integers/solution/
     * li-yong-wei-cao-zuo-shi-xian-liang-shu-qiu-he-by-p/
     */
    public int getSum(int a, int b) {
        while(b != 0){
            int temp = a ^ b;
            b = (a & b) << 1;
            a = temp;
        }
        return a;
    }
}
